<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.hwhp.entity.*"%>
<%@page import="java.text.SimpleDateFormat"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<head>
		<title>菜单</title>
		<LINK href="<%=basePath%>css/milkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>css/htmilkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<script type="text/javascript" language="javascript" src="<%=basePath%>js/commom/common.js"></script>
		<script type="text/javascript">
		//**************加载日期控件***************
		var oCalendarEn=new PopupCalendar('oCalendarEn');	//初始化控件时,请给出实例名称如:oCalendarEn
            oCalendarEn.Init();
        var oCalendarChs=new PopupCalendar('oCalendarChs');	//初始化控件时,请给出实例名称:oCalendarChs
            oCalendarChs.weekDaySting=new Array('日','一','二','三','四','五','六');
            oCalendarChs.monthSting=new Array('一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月');
            oCalendarChs.oBtnTodayTitle='今天';
            oCalendarChs.oBtnCancelTitle='取消';
            oCalendarChs.Init();
        //***********************
		
		
		 function addProcess(){
		  var menuid=document.getElementById("menuid").value;
		  var processtype=document.getElementById("processType").value;
		  if(menuid!=''){
		    if(processtype!='add'){
		      var name=document.getElementById("menuname").value;
		          document.getElementById("menuname").value="";
		      var code=document.getElementById("code").value;
		          document.getElementById("code").value="";
		     document.getElementById("parentid").value=menuid;
		     document.getElementById("parentname").value=name;
		     document.getElementById("parentcode").value=code;
		     document.getElementById("showparentcode").innerHTML=code;
		     document.getElementById("processview").innerHTML="新增";
		     document.getElementById("processType").value="add";
		      document.getElementById("buttonprcess").style.display="";
		      }
		  }else{
		    alert("请选择一个功能菜单后再进行新增操作！");
		  }
		 
		 }
		 function deleteProcess(){
		    var menuid=document.getElementById("menuid").value;
		  if(menuid!=''){
		     if(confirm("确定删除选择的功能吗？")){
		      document.getElementById("processType").value="delete";
		      fm1.submit();
		     }
		  }else{
		    alert("请选择一个功能菜单后再进行删除操作！");
		  }
		 
		 }
		  function updateProcess(){
		    var menuid=document.getElementById("menuid").value;
		  if(menuid!=''){
		     document.getElementById("processType").value="update";
		     document.getElementById("buttonprcess").style.display="";
		  }else{
		    alert("请选择一个功能菜单后再进行修改操作！");
		  }
		 
		 }
		  function init(){
		      var processtype=document.getElementById("processType").value;
		      //alert(processtype);
		      if(processtype!=""&&processtype!="null"){
		      //alert(parent.document.getElementById("workspace1").src);
		       parent.workspace1.location=parent.document.getElementById("workspace1").src;	
		      }
		  }
		  
		  function deptSelTree(){
				 var peopleid = showModalDialog("/chis/manager/login!editDepart.action?deptid=-1"+"&Random="+Math.random(),"选项分配","dialogHeight:340px;dialogLeft:490px;dialogWidth:300px;dialogTop:250px;help=0;status=0;");
			         if(typeof(peopleid)=="undefined"){ 
			               return;
			          }else{
			           var returnValue=peopleid.split("#");
			            if(returnValue.length>1){
			               var deptid=returnValue[0];
			               var deptname=returnValue[1];
			               document.getElementById("Deptname").value=deptname;
			               document.getElementById("deptid").value=deptid;
			               checkboxSelProcess(deptid);
			            }
			          }
			    }
		</script>
	</head>
	<%
	    Deptment deptment=new Deptment();
	    YzUser user=new YzUser();
	    String act=(String)request.getAttribute("act");
	    List spList = (List)request.getAttribute("spList");
	    String actName="";
	    if("add".equals(act)){
	       actName="新增";
	    }
	    if("edit".equals(act)){
	       actName="编辑";
	    }
		 deptment = (Deptment) request.getAttribute("deptObj");
		 user=(YzUser)request.getAttribute("userObj");
		if (deptment == null) {
			deptment = new Deptment();
		}
		 if(user==null){
		   user=new YzUser();
		 }
	%>
	<body style="MARGIN: 0px;" id="body">
		<form name="fm1" action="/chis/manager/user!insertUser.action" method="post">
			<TABLE cellSpacing=10 width="100%">
				<TBODY>
					<tr>
						<td class=contenttab1 height="26px">
							当前操作：<%=deptment.getDeptName() == "" || deptment.getDeptName() == null ? "": deptment.getDeptName() + ">>"%>
							<span id="processview" style="color:red"><%=actName %></span>
						</td>
					</tr>
					<TR>
						<TD class=contenttab1 vAlign=top>
							<TABLE cellSpacing=2 cellPadding=0 width="100%" border=0>
								<TBODY>
									<TR>
										<TD class=contenttab2>
											姓名
										</TD>
										<TD class=contenttab1 width="40%">
											<INPUT class=input3 id=username name=username
												value="<%=user.getUserName() %>">
											<INPUT class=input3 id=userid name=userid
												value="<%=user.getUserId() %>" type="hidden">
											<INPUT class=input3 id=act name=act
												value="<%=act%>" type="hidden">
										</TD>
										<TD class=contenttab2>
											所属部门
										</TD>
										<TD class=contenttab1 width="40%" colspan="2">
											<INPUT class=input3 id=Deptname name=Deptname
												value="<%=deptment.getDeptName() %>" readonly="readonly" >
											<INPUT class=input3 id=deptid name=deptid
												value="<%=deptment.getDeptId() %>" type="hidden">
										</TD>
										<td>
											<a onclick="deptSelTree()" title="选择部门"><img src="/chis/images/login/bm.gif"></a>
										</td>
									</TR>
									<TR>
										<TD class=contenttab2>
											民族
										</TD>
										<TD class=contenttab1 width="40%">
											<INPUT class=input3 id=minzu name=minzu
												value="<%=user.getMinzhu()%>">
										</TD>
										<TD class=contenttab2>
											文化
										</TD>
										<TD class=contenttab1 width="40%" colspan="2">
											<INPUT class=input3 id=wenhua name=wenhua
												value="<%=user.getWenhua() %>" >
										</TD>
									</TR>
									<TR>
										<TD class=contenttab2>
											出生年月
										</TD>
										<TD class=contenttab1 width="40%">
											<INPUT class=input3 id=birthdate name=birthdate value="<%=user.getBirthDate()==null?"":new SimpleDateFormat("yyyy-MM-dd").format(user.getBirthDate())%>" onclick='getDateString(this,oCalendarChs)'>
										</TD>
										<TD class=contenttab2>
											参加时间
										</TD>
										<TD class=contenttab1 width="40%" colspan="2">
											<INPUT class=input3 id=ludate name=createdate value="<%=user.getCreateDate()==null?"":user.getCreateDate()%>" onclick='getDateString(this,oCalendarChs)'>
										</TD>
									</TR>
									<TR>
										<TD class=contenttab2>
											邮箱：
										</TD>
										<TD class=contenttab1 width="40%">
											<INPUT class=input3 id=email name=email
												value="<%=user.getEmail() %>">
										</TD>
										<TD class=contenttab2>
											职务
										</TD>
										<TD class=contenttab1 width="40%" colspan="2">
										
											<select name="positionId" >
												<%
												
													for(Object o :spList){
														
														SPosition sp = (SPosition)o;
												
														
												%>
												    <option value="<%=sp.getPositionId()%>" <%=sp.getPositionId().equals(user.getPositionId())?"selected":""%>><%=sp.getName()%></option>
												<%
												
													}
												
												
												%>
											</select>
										</TD>
									</TR>
									<TR>
										<TD class=contenttab2>
											手机：
										</TD>
										<TD class=contenttab1 width="40%">
											<INPUT class=input3 id=mobile name=mobile
												value="<%=user.getMobile()%>">
										</TD>
										<TD class=contenttab2>
											籍贯：
										</TD>
										<TD class=contenttab1 width="40%" colspan="2">
											<INPUT class=input3 id=birthFrom name=birthFrom
												value="<%=user.getBirthFrom()%>">
										</TD>
									</TR>
									<TR>
										<TD class=contenttab2>
											备 注
										</TD>
										<TD class=contenttab1 colspan="4">
											<textarea class=input3 rows="8" cols="35" style="width: 100%" name="remark" id="remark"><%=user.getBeizhu()==null?"":user.getBeizhu() %></textarea>
										</TD>
									</TR>
								</TBODY>
							</TABLE>
						</TD>
					</TR>
					<tr height="40">
						<td align="center">
							<table border='0' cellpadding='2' cellspacing='0' id="buttonprcess">
								<tr height="20">
									<td style='background-image:url(<%=basePath%>images/button/w_buttonrleft1.gif);width:6px;'></td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;' onclick="fm1.submit()">
										保存
									</td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
									<td>
										&nbsp;
									</td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonrleft1.gif);width:6px;'></td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'>
										<a href="#">取消</a>
									</td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
									<td>
										&nbsp;
									</td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonrleft1.gif);width:6px;'></td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'>
										<a href="/chis/manager/user!userList.action?deptid=<%=deptment.getDeptId()%>">返回</a>
									</td>
									<td style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
								</tr>
							</table>
						</td>
					</tr>
				</TBODY>
			</TABLE>
		</form>
	</body>
</html>
